package site.assad.dynamicProxy;

/**
 * Author: Al-assad 余林颖
 * E-mail: yulinying_1994@outlook.com
 * Date: 2017/12/4 23:19
 * Description: FooService 接口基本实现类，AOP 目标类
 *              以下 // 注释的为横切逻辑代码，将其实现为增强类 PerformanaceHandler
 */
public class FooServiceImpl implements FooService{


    @Override
    public void method1() {
//        PerformanceMonitor.begin("site.assad.dynamicProxy.FooServiceImpl.method1");
        System.out.println("method1 running...");
        //模拟执行时间
        try {
            Thread.sleep(200);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
//        PerformanceMonitor.end();
    }

    @Override
    public void method2() {
//        PerformanceMonitor.begin("site.assad.dynamicProxy.FooServiceImpl.method1");
        System.out.println("method2 running...");
        try {
            Thread.sleep(300);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
//        PerformanceMonitor.end();
    }
}
